package com.tally.user.controller;

import com.tally.server.dto.EcodeDTO;
import com.tally.server.dto.ResponseDTO;
import com.tally.server.service.EcodeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: sy
 * @Date: 2020/11/13 20:13
 * @Description:
 */
@RestController
@RequestMapping("/ecode")
public class EcodeController {

    private static final Logger logger = LoggerFactory.getLogger(EcodeController.class);
    public static final String BUSINESS_NAME = "邮箱验证码";

    @Autowired
    private EcodeService ecodeService;

    @PostMapping("/send")
    public ResponseDTO send(@RequestBody EcodeDTO ecodeDTO){
        logger.info("发送邮箱验证码请求开始: {}",ecodeDTO);
        ecodeService.sendCode(ecodeDTO);
        logger.info("发送邮箱验证码请求结束");
        return ResponseDTO.success(null);
    }
}
